home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / JForth / JTools / Appls / docu.f < prev    next >
Encoding:
FORTH Source  |  1991-12-17  |  1.6 KB  |  74 lines

  1. \ Automatically generate documentation fom source code.
  2. \
  3. \ Recognition key:
  4. \ If character in first column
  5. \ and if character not a '\'
  6. \ and if "--" in comment or : in first column.
  7. \
  8. \ Author: Phil Burk
  9. \ Copyright 1988 Phil Burk
  10. \ All Rights Reserved.
  11. \
  12. \ MOD: PLB 1/17/89 Also catch words with local variables.
  13.  
  14. include? logto ju:logto
  15. include? dolines ju:dolines
  16.  
  17. ANEW TASK-DOCU
  18.  
  19. VARIABLE DOCU-SHOW-FILE
  20.  
  21. : DOCU.DEFINER?  ( $line -- flag , is this worth documenting?)
  22.     >r 0
  23.     r@ c@ 0> ( not empty )
  24.     IF r@ 1+ c@ bl > ( start with non blank )
  25.       IF r@ 1+ c@ ascii \ -
  26.         IF r@ count ascii ( scan dup 0=
  27.            IF 2drop r@ count ascii { scan dup 0>
  28.            ELSE true
  29.            THEN
  30.           IF ( --adr' len' )
  31.             ascii -  scan 0>
  32.             IF 1+ c@ ascii - =
  33.               IF drop true  ( YES!!! )
  34.               THEN
  35.             ELSE drop
  36.             THEN
  37.           ELSE 2drop
  38.           THEN
  39.         THEN
  40.       THEN
  41.     THEN
  42.     rdrop
  43. ;
  44.  
  45. : DOCU.LINE ( $line -- , print if documentable )
  46.     dup docu.definer?
  47.     IF >newline $type
  48.        docu-show-file @
  49.        IF bl 56 emit-to-column dl-filename $type
  50.        THEN
  51.        ?pause cr
  52.     ELSE drop
  53.     THEN
  54. ;
  55.  
  56. : DOCU.FILE ( <filename> -- , print stack diagrams from file)
  57.     ' docu.line is doline
  58.     dolines
  59. ;
  60.  
  61. : .DOCU ( <filename> -- , document to logto file )
  62.     logto-id @
  63.     IF  logged? not
  64.         IF logstart docu.file logstop
  65.         ELSE docu.file
  66.         THEN
  67.     ELSE docu.file
  68.     THEN
  69. ;
  70.  
  71. cr
  72. ." For optional file listing, enter:  DOCU-SHOW-FILE ON" cr
  73. ." To show stack diagrams, enter:   .DOCU <filename>" cr
  74.